<?php
namespace app\admin\controller\soft;
use app\providers\BaseController;
use app\admin\model\SystemLog;
use hg\apidoc\annotation as Apidoc;
/**
 * @Apidoc\Title("系统日志")
 * @Apidoc\Group("base")
 * @Apidoc\Sort(1)
 */
class Log extends BaseController 
{
	
	/**
     *  获取所有访问ip-去重
     * @Apidoc\Author("weifashi")
     * @Apidoc\Method("POST")
     */
	public function getAllIp($is_action_call=false){
		$result = SystemLog::distinct(true)
			->field("ip as label,ip as value")
			->order('create_time desc')
			->limit(10)
			->select();
			
		if($is_action_call){
			return $result;	
		}else{
			return \Api::ReSucess($result);	
		}
	}
	
	/**
     * 清空日志
     * @Apidoc\Author("weifashi")
     * @Apidoc\Method("POST")
     */
	public function emptyAll(){
		$result = (new SystemLog)->where('1=1')->delete();
		return \Api::ReSucess($result);	
	}
	
}



